package com.phonebrand.global;

import java.io.File;

import android.app.Application;
import android.util.Log;

import com.db4o.ObjectContainer;
import com.phonebrand.dao.DB4CommandDao;

public class GlobalApplication extends Application {
	private static final String LOG_TAG = "GlobalApplication";
	private ObjectContainer dbPhone;		
	
	
	public void onCreate() {
		super.onCreate();
		Log.i(LOG_TAG, "GlobalApplication : onCreate() ");		
		try {	    	 
			DB4CommandDao dao = DB4CommandDao.getInstance();  
			File  fullPath = getFilesDir();
			
			Log.i(LOG_TAG, "GlobalApplication : onCreate() fullPath.getAbsolutePath()+File.separator : "+fullPath.getAbsolutePath()+File.separator);
			dbPhone =  dao.openDB(fullPath.getAbsolutePath()+File.separator+DB4CommandDao.DB_PHONE);
				

			
	    } catch (Exception e) {
	    	e.printStackTrace();
			Log.e(LOG_TAG,"GlobalApplication : onCreate() "+ e.toString());	
	    }
	}


	public ObjectContainer getDbPhone() {
		return dbPhone;
	}


	public void setDbPhone(ObjectContainer dbPhone) {
		this.dbPhone = dbPhone;
	}

		
	
}
